package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_ElectronicTicketOrder 电子券单
 *
 */
public class TestData_TB_ElectronicTicketOrder
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ElectronicTicketOrder saveMust(
		org.springframework.context.ApplicationContext context
		
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ElectronicTicketOrder");
		return (TB_ElectronicTicketOrder)repository.save(newMust(
				
			));
	}
	
	public static TB_ElectronicTicketOrder newMust(
		
	){
		return new TB_ElectronicTicketOrder(new TB_ElectronicTicketOrder.MustProperties() {
			/** 编号 */
			@Override public String getNumber(){
				return Generator.generate(0, 32);
			}
			/** 标题 */
			@Override public String getName(){
				return Generator.generate(0, 50);
			}
			/** 面值 */
			@Override public Double getPrice(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
			/** 类型 */
			@Override public bairui.international.model.type.Type_ElectronicTicket getType(){
				return bairui.international.model.type.Type_ElectronicTicket.OrderOffset;
			}
			/** 数量 */
			@Override public Long getCount(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.longRandom(1, Long.MAX_VALUE);
			}
			/** 是否一次性 */
			@Override public Boolean getOneuseFlag(){
				return new java.util.Random().nextBoolean();
			}
			/** 是否可赠送 */
			@Override public Boolean getGiveFlag(){
				return new java.util.Random().nextBoolean();
			}
			/** 是否可再次领取 */
			@Override public Boolean getAgainFlag(){
				return new java.util.Random().nextBoolean();
			}
			/** 状态 */
			@Override public bairui.international.model.status.State_ElectronicTicketOrder getState(){
				return bairui.international.model.status.State_ElectronicTicketOrder.Published;
			}
			/** 有效期 */
			@Override public java.util.Date getExpiryDate(){
				return new java.util.Date();
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ElectronicTicketOrder saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_Admin publishor
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ElectronicTicketOrder");
		return (TB_ElectronicTicketOrder)repository.save(newAll(
				publishor
			));
	}
	
	public static TB_ElectronicTicketOrder newAll(
		bairui.international.model.domain.jpa.TB_Admin publishor
	){
		return new TB_ElectronicTicketOrder(
			new TB_ElectronicTicketOrder.MustProperties() {
				/** 编号 */
				@Override public String getNumber(){
					return Generator.generate(0, 32);
				}
				/** 标题 */
				@Override public String getName(){
					return Generator.generate(0, 50);
				}
				/** 面值 */
				@Override public Double getPrice(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 类型 */
				@Override public bairui.international.model.type.Type_ElectronicTicket getType(){
					return bairui.international.model.type.Type_ElectronicTicket.OrderOffset;
				}
				/** 数量 */
				@Override public Long getCount(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.longRandom(1, Long.MAX_VALUE);
				}
				/** 是否一次性 */
				@Override public Boolean getOneuseFlag(){
					return new java.util.Random().nextBoolean();
				}
				/** 是否可赠送 */
				@Override public Boolean getGiveFlag(){
					return new java.util.Random().nextBoolean();
				}
				/** 是否可再次领取 */
				@Override public Boolean getAgainFlag(){
					return new java.util.Random().nextBoolean();
				}
				/** 状态 */
				@Override public bairui.international.model.status.State_ElectronicTicketOrder getState(){
					return bairui.international.model.status.State_ElectronicTicketOrder.Published;
				}
				/** 有效期 */
				@Override public java.util.Date getExpiryDate(){
					return new java.util.Date();
				}
			},
			new TB_ElectronicTicketOrder.OptionalSingleProperties() {
				/** 申请时间 */
				@Override public java.util.Date getApplyDate(){
					return new java.util.Date();
				}
				/** 生成时间 */
				@Override public java.util.Date getGenerateDate(){
					return new java.util.Date();
				}
				/** 发布者 */
				@Override public bairui.international.model.domain.jpa.TB_Admin getPublishor(){
					return publishor;
				}
				/** 备注 */
				@Override public String getComment(){
					return Generator.generate(0, 500);
				}
			}
		);
	}
	

}
